package com.jindi.appuser.util.weixin;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import com.github.wxpay.sdk.WXPayConfig;

public class MyConfig implements WXPayConfig{
	private byte[] certData;

    public MyConfig() throws Exception {
        String certPath = "";
        String os = System.getProperty("os.name");
        if(os.toLowerCase().startsWith("win")){
        	certPath = "C:/Users/Administrator/Downloads/WXCertUtil-1.0/WXCertUtil/log/yys_cert.p12";
        }else {
        	certPath = "/var/local/yys_cert.p12";
        }
        File file = new File(certPath);
        InputStream certStream = new FileInputStream(file);
        this.certData = new byte[(int) file.length()];
        certStream.read(this.certData);
        certStream.close();
    }

	@Override
	public String getAppID() {
		// TODO Auto-generated method stub
		return "wx69ad8d5e7afbed71";
	}

	@Override
	public InputStream getCertStream() {
		// TODO Auto-generated method stub
		ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
	}

	@Override
	public int getHttpConnectTimeoutMs() {
		// TODO Auto-generated method stub
		return 8000;
	}

	@Override
	public int getHttpReadTimeoutMs() {
		// TODO Auto-generated method stub
		return 10000;
	}

	@Override
	public String getKey() {
		// TODO Auto-generated method stub
		//return "1awdewfrv54h6g4f8hn6f9jrvdg65hg7";
		return "VGMXQK23KRIC0W6N7SK4NYMYPD5IR0DQ";
	}

	@Override
	public String getMchID() {
		// TODO Auto-generated method stub
		return "1517379561";
	}

}
